<html>
<head>
  <title>楼盘管理——图片信息</title>
  <meta name="layout" content="common_header"/>
  <script type="text/javascript" src="${resource(dir: 'js/jquery', file: 'jquery.form.min.js', absolute: true)}"></script>
  <script type="text/javascript" src="${resource(dir: 'js/jquery', file: 'jquery.metadata.pack.js', absolute: true)}"></script>
  <script type="text/javascript" src="${resource(dir: 'js/jquery', file: 'common.custom.js', absolute: true)}"></script>
  <script type="text/javascript">
    var estateId = '${flash.estateId}';
    function approveEstate(id, flag) {
      jQuery("#id").val(id)
      jQuery("#flag").val(flag)
      jQuery("#submitForm").ajaxSubmit({
        success: function(response) {
          if (response == "1") {
            jQuery("#approveFlag_" + id).html(flag == "1" ? "通过" : "不通过")
          } else {
            alert("审批出错")
          }
        }
      });
    }
    function storage(picId, infoId) {
      jQuery.post("${createLink(controller:'estate',action:'storage',absolute:true)}", {id:picId,estateId:estateId,infoId:infoId}, function(response) {
        if (response == 'true') {
          $("#okflag_" + picId).html("<a href=\"javascript:deletePic(" + picId + ")\"><font color='blue'>删除</font></a>");
        }
      });
    }
    function deletePic(id) {
      jQuery.post("${createLink(controller:'picture',action:'delete',absolute:true)}", {id:id,view: '/estate/estatePic'}, function(response) {
        if (response == 'true') {
          $("#tr_" + id).remove();
        }
      })
    }
  </script>
</head>
<body>
<div id="man_zone">
  <!--
  <form id="submitForm" name="submitForm" action="${createLink(controller: "admin", action: 'approveEstate', absolute: true)}" method="post">
    <input type="hidden" id="id" name="id"/>
    <input type="hidden" id="flag" name="flag"/>
  </form>
  <form id="queryForm" name="queryForm" action="${createLink(controller: "scaffold", action: 'list', absolute: true)}" method="post">
  <input type="hidden" name="property" value="${params?.property}"/>
  <table width="95%" border="0" align="center"  cellpadding="3" cellspacing="1" class="table_style">
     <tr>
       <td class="left_title_1">楼盘名称</td>
       <td class="fillin">
         <input type="text" id="zlk_name" name="zlk_name" value="${params?.zlk_name}">
       </td>
       <td class="left_title_1">审核状态</td>
       <td class="fillin">
        <input type="radio" name="aeq_approveFlag" value="" <g:if test="${params?.aeq_approveFlag==''||params?.aeq_approveFlag==null}">checked</g:if> /> 全部
        <input type="radio" name="aeq_approveFlag" value="0" <g:if test="${params?.aeq_approveFlag=='0'}">checked</g:if> />未审核
        <input type="radio" name="aeq_approveFlag" value="1" <g:if test="${params?.aeq_approveFlag=='1'}">checked</g:if> />通过
        <input type="radio" name="aeq_approveFlag" value="2" <g:if test="${params?.aeq_approveFlag=='2'}">checked</g:if> />不通过
       </td>
    </tr>
    <tr>
      <td class="fillin" colspan="4" align="center"><input type="image" src="${resource(dir: '/images/admin_ui/', file: 'query1.gif', absolute: true)}" alt="查询"/></td>
    </tr>
  </table>
  </form>
 -->
  <br>

  <table cellpadding="0" cellspacing="0" width="95%" align="center" class="xtable">
    <thead>
    <tr>
      <td>图片名称</td>
      <td>操作</td>
      <td>图片类型</td>
      <td>描述</td>
      <td>略图</td>
    </tr>
    </thead>
    <tbody>

    <g:each var="info" in="${list.items}">
      <g:each in="${info.pictures}">
        <g:if test="${it.type == flash.type}">
          <tr id="tr_${it.id}" class="${(it.fromEstate == null) ? 'isNo' : 'isOK'}">
            <td><a href="${createLink(controller: 'scaffold', action: 'show', absolute: true)}?property=Picture&id=${it.id}">${it.fileName}</a></td>
            <td id="okflag_${it.id}"><g:if test="${it?.fromEstate==null}"><a href="javascript:storage('${it.id}','${info.id}')"><font color="blue">入库|</font></g:if><a href="javascript:deletePic('${it.id}')"><font color="blue">删除</font></a></td>
            <td><g:if test="${it.type == '10'}">楼盘图片</g:if><g:elseif test="${it.type == '20'}">房型图片</g:elseif><g:elseif test="${it.type == '30'}">室内图片</g:elseif></td>
            <td>${it.description}</td>
            <td><a href="${resource(dir: '/upload/info_picture/', file: it.fileName, absolute: true)}" target="_blank"><img src="${resource(dir: '/upload/info_picture/', file: it.fileName, absolute: true)}" width="50" height="50"/></a></td>
          </tr>
        </g:if>
      </g:each>
    </g:each>
    </tbody>
    <tfoot>
    <tr>
      <td colspan="10" align="center">
        <g:paginate total="${list.count}" params="${params}"/>
      </td>
    </tr>
    </tfoot>
  </table>

</div>
<script type="text/javascript">
  <g:if test="${flash.okFlag=='true'}">
  hide(jQuery(".isNo"))
  </g:if>
  <g:elseif test="${flash.okFlag=='false'}">
  hide(jQuery(".isOK"))
  </g:elseif>
</script>
</body>
</html>
